/**
 *
 * @param bayWidth
 * @param xCenter
 * @param width
 * @param origin 为left即为左侧原点
 * @returns
 */
export const getLeft = (bayWidth: number, xCenter: number, width: number, px: number, origin: string) => {
  if (origin === 'left') {
    return (xCenter - width / 2) * px;
  } else {
    return (bayWidth - xCenter - width / 2) * px;
  }
};

/**
 *
 * @param bayHeight
 * @param yCenter
 * @param height
 * @param origin 为top时即为上侧原点
 * @returns
 */
export const getTop = (bayHeight: number, yCenter: number, height: number, py: number, origin: string) => {
  if (origin === 'top') {
    return (yCenter - height / 2) * py;
  } else {
    return (bayHeight - yCenter - height / 2) * py;
  }
};
